<%--
  Created by IntelliJ IDEA.
  User: Colorful
  Date: 2023/8/3
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<script src="${path}/js/jquery-3.6.4.js" rel="script"></script>
<link rel="stylesheet" type="text/css" href="${path}/css/homeContent.css">
<div class="container">
    <div class="main">
        <div class="content">
            <div class="hot_content_title">
                <h2 class="content_font">正在热映(28部)</h2>
                <a href="#">全部></a>
            </div>
            <c:set var="hotMovie" value="${sessionScope.hotMovie}"/>
            <c:choose>
                <c:when test="${empty hotMovie}">
                    <script>
                        window.location='${path}/MovieHomeServlet?prom=hot';
                    </script>
                </c:when>
                <c:otherwise>
                    <div class="hot_content"><%--左边显示图片--%>
                        <dl>
                            <c:forEach var="hm" items="${hotMovie}">
                                <dd id="${hm.movie_id}" onclick="href(${hm.movie_id})">
                                    <img src="${path}/images/moviePicture/${hm.movie_picture}">
                                    <div class="hot_content_text">购买</div>
                                    <div class="hotMovie-info">
                                        <div class="movie-score">
                                                ${hm.movie_score}
                                        </div>
                                        <div class="movie-title movie-title-padding">
                                                ${hm.movie_cn_name}
                                        </div>
                                    </div>
                                </dd>
                            </c:forEach>
                        </dl>
<%--                        热映具体内容--%>
                    </div>
                </c:otherwise>
            </c:choose>
        </div>
        <%--  正在热映结尾  --%>
        <div class="content">
            <div class="pre_content_title">
                <h2 class="content_font">即将上映(127部)</h2>
                <a href="#">全部></a>
            </div>
            <c:set var="preMovie" value="${sessionScope.preMovie}"/>
            <c:choose>
                <c:when test="${empty preMovie}">
                    <script>
                        window.location='${path}/MovieHomeServlet?prom=pre';
                    </script>
                </c:when>
                <c:otherwise>
                    <div class="pre_content"><%--左边显示图片--%>
                        <dl>
                            <c:forEach var="pm" items="${preMovie}">
                                <dd id="${pm.movie_id}" onclick="href(${pm.movie_id})">
                                    <img class="movie-img" src="${path}/images/moviePicture/${pm.movie_picture}">

                                    <div class="movie-detail movie-wish">
                                        <span class="font">456万人想看</span>
                                    </div>
                                    <div class="pre_content_text">
                                        预售
                                    </div>
                                    <div class="pre_date">
                                            ${pm.movie_releaseDate}
                                    </div>
                                    <div class="preMovie-info">
                                        <div class="movie-title movie-title-padding">
                                                ${pm.movie_cn_name}
                                        </div>
                                    </div>
                                </dd>
                            </c:forEach>
                        </dl>
                    </div>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
    <div class="aside">
        <div class="panel">
            <div class="panel-header">
                <h2 class="content_font">今日票房</h2>
            </div>
            <c:set var="officeMovie" value="${sessionScope.officeMovie}"/>
            <c:choose>
                <c:when test="${empty officeMovie}">
                    <script>
                        window.location='${path}/MovieHomeServlet?prom=office';
                    </script>
                </c:when>
                <c:otherwise>
                    <div class="panel-content">
                        <ul>
                            <c:forEach  var="om" items="${officeMovie}" varStatus="vs">
                                <li class="ranking-item" id="${om.movie_id}"onmousemove="changemove(this)" onmouseout="changeout(this)" onclick="href(${om.movie_id})">
                                    <span class="normal-link">
                                            <span class="ranking-index">${vs.count}</span>
                                            <span class="ranking-movie-name">${om.movie_cn_name}</span>
                                    </span>
                                    <span class="ranking-num-info">${om.movie_boxOffice}亿</span>
                                </li>

                            </c:forEach>
                        </ul>
<%--                        今日票房--%>
                    </div>
                </c:otherwise>
            </c:choose>
            <%--            panel-content结尾--%>
        </div>
        <%--     今日票房   panel结尾--%>
        <div class="box_total">
            <div><h3>今日转盘</h3></div>
            <div>
                <p>
                    <span class="stonefont" >3144.8万</span>
                    <a class="more">查看更多></a>
                </p>
                <p class="meta_info">
                    北京时间 10:56:53
                    <span class="pull_right">猫眼专业版实时票房数据</span>
                </p>
            </div>
        </div>
        <%--    Toop100开始--%>
        <div class="panel">
            <div class="panel-header">
                <span class="panel-more">查看完整榜单></span>
                <h2 class="panel-title">TOP 100</h2>
            </div>
            <c:set var="topMovie" value="${sessionScope.topMovie}"/>
            <c:choose>
                <c:when test="${empty topMovie}">
                    <script>
                        window.location='${path}/MovieHomeServlet?prom=top';
                    </script>
                </c:when>
                <c:otherwise>
                    <div class="panel-content">
                        <ul>
                            <c:forEach  var="tm" items="${topMovie}" varStatus="vs">
                                <li class="ranking-item" id="${tm.movie_id}"onmousemove="changemove(this)" onmouseout="changeout(this)" onclick="href(${tm.movie_id})">
                                    <span class="normal-link">
                                            <span class="ranking-index">${vs.count}</span>
                                            <span class="ranking-movie-name">${tm.movie_cn_name}</span>
                                    </span>
                                    <span class="topMovieScore">${tm.movie_score}分</span>
                                </li>
                            </c:forEach>
                        </ul>
                            <%--                        今日票房--%>
                    </div>
                </c:otherwise>
            </c:choose>
            <%--            panel-content结尾--%>
        </div>
        <%--     今日票房   panel结尾--%>
        <div class="div"></div>
    </div>
<%--    aside右侧盒子--%>
</div>
<%--外面包裹最大的盒子--%>
<script>
    /*
    鼠标悬浮移除事件
    改变今日票房的背景色
    */
    function changemove(move){
        $(move).css("background-color","#f2f2f2");
    }
    function changeout(out){
        $(out).css("background-color","#fff");
    }
    function href(a) {
        window.location='${path}/MovieFlServlet?prom=select&movie_id='+a;
    }
</script>
